<?php 
require 'usuario.php';
if(!empty($_POST)){
	$p = $_POST;
	$usuario = new Usuario();
	$usuario->setNome($p['nome']);
	$usuario->setEmail($p['email']);
	//$usuario->setSenha($p['senha']);
	$usuario->setSenha(md5($p['senha']));
	
	require '../database.php';
	
	$pdo = Database::connect();
	$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$sql = "INSERT INTO usuarios (nome, email, senha) values(?, ?, ?)";
	$q = $pdo->prepare($sql);
	$q->execute(array($usuario->getNome(), $usuario->getEmail(), $usuario->getSenha()));
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>SIRI - Login</title>
	<style type="text/css">@import url('../css/bootstrap.css');</style>
</head>
<body>
<div class="container">
	<div class="row clearfix">
		<div class="col-md-12 column">
			<div class="row clearfix">
				<div class="col-md-3 column">
				</div>
				<div class="col-md-6 column">
					<h2 class="text-center">
								<img src="../img/ifsertao.jpg" align="center"></br>
								</br>Cadastrando Usuário
							</h2><br><br>
					<div class="col-md-3 column">
					</div>
					<div class="col-md-6 column">
						<form role="form" action="criando_usuario.php" method="post" target="_self">
						<div class="form-group">
							 <label for="exampleInputEmail1">Nome:</label><input type="text" class="form-control" id="nome" name="nome" value="" />
						</div>
						<div class="form-group">
							 <label for="exampleInputEmail1">Email:</label><input type="email" class="form-control" id="email" name="email" value="" />
						</div>
						<div class="form-group">
							 <label for="exampleInputPassword1">Senha:</label><input type="password" class="form-control" id="senha" name="senha" value="" />
						</div>
						<div class="">
						</div> <button type="submit" id="acao" name="acao" value="logar" class="btn btn-primary">Cadastrar</button>
					</form>
					</div>
					<div class="col-md-3 column">
					</div>
	<!--<script src="http://code.jquery.com/jquery-latest.min.js"></script>-->
	<script src="../js/bootstrap.js"></script>
</body>
</html>